package com.platform.enums;

import com.platform.comm.constants.EnumOption;
import com.platform.comm.enums.IDictEntry;
import com.platform.comm.enums.IEnumItem;
import com.platform.comm.enums.IEnumOption;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

@EnumOption(name = "batchJobType")
public enum BatchJobType implements IDictEntry, IEnumItem, IEnumOption<String> {

    /**
     * 导入导出类型
     */
    EXPORT("EXPORT", "批量导出"),
    IMPORT("IMPORT", "批量导入"),
    ODS_CRON_IMPORT("ODS_CRON_IMPORT", "贴源交换定时全批次"),
    ODS_REPAIR_IMPORT("ODS_REPAIR_IMPORT", "错误数据修复后数据医院交换"),
    USER_IMPORT("USER_IMPORT","用户批量导入"),
    USER_EXPORT("USER_EXPORT","用户批量导出"),
    DEPART_IMPORT("DEPART_IMPORT","部门批量导入"),
    DEPART_EXPORT("DEPART_EXPORT","部门批量导出"),
    RESOURCE_IMPORT("RESOURCE_IMPORT","资源目录导入"),
    EVAL_NAT_IMPORT("EVAL_NAT_IMPORT", "自然人模板导入信用评价"),
    EVAL_LEG_IMPORT("EVAL_LEG_IMPORT", "自然人模板导入信用评价"),
    URP_MEASURE_IMPORT("URP_MEASURE_IMPORT", "奖惩措施导入"),
    URP_MEASURE_EXPORT("URP_MEASURE_EXPORT", "奖惩措施导出"),
    CENTER_IMPORT("CENTER_IMPORT","数据中心批量导入"),
    CENTER_EXPORT("CENTER_EXPORT","数据中心批量导出"),
    CENTER_UPDATE("CENTER_UPDATE","数据中心批量更新"),
    DIR_WRONG_EXPORT("DIR_WRONG_EXPORT","数据归集错误数据批量导出"),
    DIR_INSPECT_EXPORT("DIR_INSPECT_EXPORT","数据归集核查失败数据批量导出"),
    DIR_QUE_EXPORT("DIR_QUE_EXPORT","数据归集疑问数据批量导出"),
    DIR_TOAUDIT_EXPORT("DIR_TOAUDIT_EXPORT","数据归集待审核数据批量导出"),
    DIR_WRONG_UPDATE("DIR_WRONG_UPDATE","数据归集错误数据批量更新"),
    DIR_QUE_UPDATE("DIR_QUE_UPDATE","数据归集疑问数据批量更新"),
    DIR_INSPECT_UPDATE("DIR_INSPECT_UPDATE","数据归集核查失败数据批量更新")
    ;

    public final String code;
    public final String title;


    BatchJobType(String code, String title) {
        this.code = code;
        this.title = title;
    }

    @Override
    public boolean is(String code) {
        return this.code.equals(code);
    }

    @Override
    public String getKey() {
        return code;
    }

    @Override
    public String getValue() {
        return title;
    }

    @Override
    public Object getData() {
        return this;
    }

    /**
     * 枚举项 “键”
     *
     * @return key
     */
    @Override
    public String key() {
        return code;
    }

    /**
     * 枚举项 “值”
     *
     * @return value
     */
    @Override
    public String value() {
        return title;
    }

    /**
     * 枚举options
     *
     * @return
     */
    @Override
    public Map<String, String> enums() {
        return Arrays.stream(values()).collect(Collectors.toMap(IEnumOption::key, IEnumOption::value));
    }
}
